local OneSprite = import("app.views.OneSprite")
local MainScene = class("MainScene", cc.load("mvc").ViewBase)

function MainScene:onCreate()
    local sprite = OneSprite.new()
        :addTo(self)
        :move(display.cx, display.cy)

    sprite:addEventListener("HideSprite", handler(self, self.onEvent)) -- see function.lua "function handler"

    local scheduler = self:getScheduler()
    local id
    id = scheduler:scheduleScriptFunc(function()
        scheduler:unscheduleScriptEntry(id)
        sprite:hide()
    end, 2, false)
end

function MainScene:onEvent(event)
    print("sprite hide! eventName:", event.name)
end

return MainScene
